﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Jxym.wlkc2011.Module.CMS.MODEL;
using Jxym.DBUtility;

namespace Jxym.wlkc2011
{
    public partial class InfoBox1 : System.Web.UI.UserControl
    {
        private string siteName;
        private string classTitle;
        private int classId = 0;
        private int topN = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.Params["siteName"] != null)
                {
                    siteName = Request.Params["siteName"];

                    BinData();
                }
            }
        }

        private void BinData()
        {
            MsSqlDal<Cms_ContentClass> ccc = new MsSqlDal<Cms_ContentClass>();

            Cms_ContentClass cccInfo = ccc.GetModel("siteName='" + siteName + "' AND Title='" + classTitle + "'", null);

            if (cccInfo != null)
            {
                classId = cccInfo.ID;

                MsSqlDal<Cms_Content> cct = new MsSqlDal<Cms_Content>();

                IList<Cms_Content> list = cct.GetList("ContentClassID=" + cccInfo.ID, null, "AddTime", topN);

                Repeater1.DataSource = list;

                Repeater1.DataBind();
            }
        }


        public string SiteName { get { return siteName; } set { siteName = value; } }
        public string ClassTitle { get { return classTitle; } set { classTitle = value; } }
        public int TopN { get { return topN; } set { topN = value; } }
        public int ClassId { get { return classId; } set { classId = value; } }
    }
}